package morenoapp.model.impl;

import morenoapp.model.data.MorenoMeasureFace;

/**
 *
 * @author root
 */
public class MorenoMeasureImpl implements MorenoMeasureFace{
    double[] weights;

    public MorenoMeasureImpl(double... weights) {
        if (weights==null || weights.length==0){
            throw new IllegalArgumentException("No weights specified");
        }
        this.weights = weights;
    }

    public double getWeight(int position) {
        if (position<0){
            throw new IllegalArgumentException("Position must not be negative");
        }
        if (position>=weights.length){
            return weights[weights.length-1];
        } else {
            return weights[position];
        }
    }
}
